<!--
/**
* Author: zyf
* Date: 2020-07-08 14:05
* Desc: ZmFormItem
*/
-->

<template>
  <el-form-item v-bind="$attrs" v-on="$listeners" ref="zmFormItem">
    <slot slot="label" name="label" />
    <slot />
  </el-form-item>
</template>

<script>
export default {
  name: 'ZmFormItem',
  data () {
    return {
    }
  },
  created () {
    this.init()
  },
  methods: {
    // 初始化方法
    init () {
      this.proxy()
    },
    getRef () {
      return this.$refs.zmFormItem
    },
    proxy () {
      // 代理原始方法
      let array = ['resetField', 'clearValidate']
      let vm = this
      array.forEach(key => {
        Object.defineProperty(this, key, {
          get () {
            return vm.getRef()[key]
          }
        })
      })
    }
  }
}

</script>
<style lang='scss' scoped>
</style>
